package com.jinfang.bankpractice.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.jinfang.bankpractice.mapper.UserMapper;
import com.jinfang.bankpractice.model.User;

@Service
public class UserService{

	@Resource
	private UserMapper userMapper;
	
	public User login(String username,String password){
		User user=userMapper.find(username, password);
		if(user!=null)
			return user;
		return null;
	}
	
	
	
	public boolean add(User user) {
		return userMapper.insertUser(user)>=1;
	}

	
	public boolean delete(Long id) {
		return userMapper.deleteUser(id)>=1;
	}

	
	public boolean edit(User user) {
		return userMapper.updateUser(user)>=1;
	}

	
	public User get(Long id) {
		return userMapper.getUserById(id);
	}


	

	
	public Long countBySample(User user) {
		return userMapper.countBySample(user);
	}

	

}
